package com.yaj.myfactorysupport.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yaj.myfactorysupport.entity.TTrailSmtRoll;
import com.yaj.myfactorysupport.mapper.TTrailSmtRollMapper;
import com.yaj.myfactorysupport.service.TTrailSmtRollService;
import com.yaj.myfactorysupport.util.ErrorCodeEnum;
import com.yaj.myfactorysupport.util.RespBean;
import com.yaj.myfactorysupport.util.SucessCodeEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wei
 * @since 2021-06-15
 */
@Slf4j
@Service
public class TTrailSmtRollServiceImpl extends ServiceImpl<TTrailSmtRollMapper, TTrailSmtRoll> implements TTrailSmtRollService {
    @Resource
    private TTrailSmtRollMapper tTrailSmtRollMapper;


    @Override
    public RespBean RegTrailSMTRoll(TTrailSmtRoll tTrailSmtRoll) {
        try {
            int result = tTrailSmtRollMapper.insert(tTrailSmtRoll);
            if(result ==1){
                return RespBean.success(SucessCodeEnum.插入成功.getMsg());
            }
        } catch (Exception e) {
            log.error(e.getMessage());
        }

        return RespBean.error(ErrorCodeEnum.插入记录失败.getCode(),ErrorCodeEnum.插入记录失败.getMsg());
    }
}
